﻿$(document).ready(function () {
    var J_payment = $("#J_payment");
    var J_paytip = $("#J_paytip");
    var J_paygatewayform = $("#J_paygatewayform");
    var J_light = $("#J_light");
    //加载支付方式
    J_payment.load($("#J_payment_load").val());
    //点击
    J_payment.find("a").live("click", function () {
        var t = $(this);
        if (!!t.attr("href") == false) { return; };
        J_light.show();
        J_light.find(".light-bg").css({ height: $(document).height(), width: $(document).width() });
        J_light.find(".light-box").css({ left: ($(window).width() - J_light.find(".light-box").width()) / 2, top: ($(window).height() - J_light.find(".light-box").height()) / 2 });
        J_light.find(".light-iframe").css("height", $(document).height());
        J_light.find(".btnyes").click(function () {
            window.close();
        });
        $("#J_paymentOrderId").val(t.attr("data-orderid"));
        $("#J_paymentChannle").val(t.attr("data-channle"));
        J_paygatewayform.submit();
    }).live("mouseover", function () {
        var t = $(this);
        J_paytip.show().attr("class", t.attr("class")+"-tip").find("span").html(t.attr("data-content"));
    }).live("mouseout", function () {
        J_paytip.hide();
    });

    J_light.find(".light-close, a.btnyes").click(function () {
        J_light.hide();
    });
    J_light.find("a.btnyes").attr("href", "javascript:void(0)");
});